import type { AjaxFileResult } from '@/types'

const controller = getAjaxBaseUrl('/minio', '/energy')

/**
 * 保存或更新文件预览信息
 */
export function upload(file: File) {
  return post<AjaxFileResult>(
    `${controller}/upload`,
    { file },
    {
      'Content-Type': 'multipart/form-data',
    },
  )
}

/**
 * 附件删除
 */
export function deleteFileById(fileName: string) {
  return get(`${controller}/remove`, { fileName })
}
